package hou;

public class Test07 {
    static {
        System.out.println("Main");
    }

    public static void main(String[] args) throws ClassNotFoundException {
        //主动引用
//        Son son = new Son();

        //反射也会产生主动引用
//        Class.forName("hou.Son");
//        Main
//        father
//        Son
        //不会产生引用
//        System.out.println(Son.f);
//        Main
//        father
//        0

//        Son[] sons = new Son[5];
//        Main

        System.out.println(Son.n);
//        Main
//        1
    }
}

class Father{
    static int f = 0;
    static {
        System.out.println("father");
    }
}

class Son extends Father{
    static{
        System.out.println("Son");
        m = 300;
    }

    static int m = 200;
    static final int n = 1;
}